package com.example.demo;

import lombok.extern.slf4j.Slf4j;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
//import org.flywaydb.core.Flyway;
import org.junit.jupiter.api.Test;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

//暂时只写网页端
@ComponentScan
@ServletComponentScan
@MapperScan(value = "com.example.demo.mapper")
@ComponentScan("com.example.demo.swagger")
@EnableSwagger2
@SpringBootApplication
@EnableWebMvc
@Slf4j
public class DemoApplication {
    Logger logger = LogManager.getLogger(LogManager.ROOT_LOGGER_NAME);

    //    System.getenv  获取环境变量
    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
        String url = "jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&rewriteBatchedStatements=true&useSSL=false&serverTimezone=GMT%2B8";
        String user = "root";
        String password = "root";
//        Flyway flyway = Flyway.configure().dataSource(url, user, password).load();

        // 创建 flyway_schema_history 表
//		flyway.baseline();

        // 删除 flyway_schema_history 表中失败的记录
//		flyway.repair();

        // 检查 sql 文件
//		flyway.validate();

        // 执行数据迁移
//        flyway.migrate();

        // 删除当前 schema 下所有表
//		flyway.clean();

    }

    @Test
    public void contextLoads() {
    }

    @Test
    public void logger() {
        logger.debug("统计异常池数量异常,异常信息如下:e.getStackTrace().toString()");
        logger.error("统计异常池数量异常,异常信息如下:e.getStackTrace().toString()");
        logger.info("统计异常池数量异常,异常信息如下:e.getStackTrace().toString()");
//————————————————qwqqwqw
//		版权声明：本文为CSDN博主「张小凡vip」的原创文章，遵循CC 4.0 BY-SA版权协议，转载请附上原文出处链接及本声明。
//		原文链接：https://blog.csdn.net/zzq900503/article/details/8762
    }
}